import Mock from './config'

const root = process.env.NODE_ENV === 'development' ? '/api' : ''


Mock.mock(`${root}/list`, 'post',
  {
    code: 200,
    msg: '操作成功',
    cause: null,
    errorLevel: null,
    data: {
      list: [
        {
          id: 1,
          name: '测试1',
          age: '1',
          address: '测试1'
        },
        {
          id: 2,
          name: '测试2',
          age: '2',
          address: '测试2'
        },
        {
          id: 3,
          name: '测试3',
          age: '3',
          address: '测试3'
        },
        {
          id: 4,
          name: '测试4',
          age: '4',
          address: '测试4'
        }]
    }
  }
)

Mock.mock(`${root}/login`, 'post',
  {
    code: 200,
    msg: '操作成功',
    data: {
      token: 'eyJhbGciOiJIUzI1NiIsInppcCI6IkdaSVAifQ.H4sIAAAAAAAAAFWMQQqAIBAA_7JnBd1dbes3bhoYJEEFQfT3gk5dh5m5YDsUBkh5qQ0M1LTD4GMkROmEDTSd_mDe6-uLw0A6smXlbNm5aLUvZLP2EVNCpyzvrpzrV5MPXvh-APjpsu9vAAAA.9nju1qsBruNXDS2OTpxJ3TEufuT-l3kDgeYQZ-yTvvA',
      user: {
        name: '汪玉山',
        id: '9999999'
      }
    }
  }
)

// 登录失效mock
Mock.mock(`${root}/guoqi`, 'post', {
  code: 1002,
  msg: '登录已失效，请重新登录！'
})

